<?php
namespace app\store\controller\apps\dealer;

use app\store\controller\Controller;

use app\store\model\dealer\Record as RecordModel;
use app\store\model\dealer\RecordLog;

/**
 * 级差结算记录
 * Class Record
 * @package app\store\controller\apps\dealer
 */
class Record extends Controller
{
    public function index($user_id = null)
    {
        $model = new  RecordModel();

        return $this->fetch('index', [
            'list' => $model->getList($user_id),
        ]);
    }

    public function details($record_id = null){
        $model = new RecordLog();
        return $this->fetch('details', [
            'list' => $model->getList($record_id),
        ]);
    }
    /**
     * 结算级差
     */
    public function calculation(){
        if (RecordModel::calculation()) {
            return json($this->renderSuccess('操作成功'));
        }
        return $this->renderError('操作失败');
    }
}